<?php

namespace App\Http\Requests\V3_2_7;

use Illuminate\Foundation\Http\FormRequest;

class ScanCodeInStorageRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'type_id' => 'required|integer',//商品id
            'num' => 'required|numeric|min:1',//商品id
            'storage_id' => 'nullable|integer|min:0',//仓库id
            'shelf_id' => 'nullable|integer|min:0',//货架id
            'location_id' => 'nullable|integer|min:0',//库位id
            'lable_id' => 'nullable|integer|min:0',//库位id
            'in_storage_id' => 'nullable|integer|min:0',//入仓库id（调拨）
            'in_shelf_id' => 'nullable|integer|min:0',//入货架id（调拨）
            'in_location_id' => 'nullable|integer|min:0',//入库位id（调拨）
        ];
    }

    /**
     * 验证错误信息.
     *
     * @return array
     */
    public function messages(): array
    {
        return [
            'type_id.required' => '参数`仓库id`缺失',
            'type_id.integer' => '参数`仓库id`为整数',
            'num.required' => '参数`操作数量`必填',
            'num.numeric' => '参数`操作数量`为数字',
            'num.min' => '参数`操作数量`最小为1',
            'storage_id.integer' => '参数`仓库id`为整数',
            'shelf_id.integer' => '参数`货架id`为整数',
            'location_id.integer' => '参数`库位id`为整数',
            'lable_id.integer' => '参数`标签id`为整数',
            'lable_id.min' => '参数`标签id`最小为0',
            'storage_id.min' => '参数`仓库id`最小为0',
            'shelf_id.min' => '参数`货架id`最小为0',
            'location_id.min' => '参数`库位id`最小为0',
            'in_storage_id.integer' => '参数`目标仓库id`为整数',
            'in_shelf_id.integer' => '参数`目标货架id`为整数',
            'in_location_id.integer' => '参数`目标库位id`为整数',
            'in_storage_id.min' => '参数`目标仓库id`最小为0',
            'in_shelf_id.min' => '参数`目标货架id`最小为0',
            'in_location_id.min' => '参数`目标库位id`最小为0',
        ];
    }
}
